FROM maven:3-jdk-8-alpine
WORKDIR /app
COPY pom.xml ./pom.xml
RUN mvn clean package -Dmaven.test.skip=true

FROM maven:3-jdk-8-alpine
WORKDIR /app
COPY src ./src
COPY --from=0 /app/pom.xml ./pom.xml
COPY --from=0 /root/.m2 /root/.m2
RUN mvn package -Dmaven.test.skip=true

FROM registry.cn-beijing.aliyuncs.com/codeforfun/liquibase:latest
COPY --from=1 /app/target/app.jar /app/app.jar
ADD entrypoint.sh /usr/local/bin/entrypoint.sh
RUN wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.18/mysql-connector-java-8.0.18.jar -O /liquibase/mysql.jar
ENTRYPOINT ["entrypoint.sh"]
CMD ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app/app.jar"]




